﻿using System.Collections.Generic;

namespace MugenInjection.Interface
{
    /// <summary>
    /// Providing specific setting.
    /// </summary>
    public interface ISettings : IEnumerable<KeyValuePair<string, object>>
    {
        /// <summary>
        /// Gets or sets the value associated with specified name.
        /// </summary>
        /// <param name="name">The setting name of the value to get or set.</param>
        /// <returns>The specified setting value.</returns>
        object this[string name] { get; set; }

        /// <summary>
        /// Adds the value associated with specified name.
        /// </summary>
        /// <param name="name">The setting name of the value to set.</param>
        /// <param name="obj">The specified setting value.</param>
        void Add(string name, object obj);

        /// <summary>
        /// Removes the value associated with specified name.
        /// </summary>
        /// <param name="name">The setting name of the value to remove.</param>
        bool Remove(string name);

        /// <summary>
        /// Gets the value associated with specified name.
        /// </summary>
        /// <param name="name">The setting name of the value to get.</param>
        /// <returns>The specified setting value.</returns>
        object Get(string name);

        /// <summary>
        /// Gets the value associated with specified name.
        /// </summary>
        /// <param name="name">The setting name of the value to get.</param>
        /// <returns>The specified setting value.</returns>
        T Get<T>(string name);

        /// <summary>
        /// Try gets the value associated with specified name.
        /// </summary>
        /// <param name="name">The setting name of the value to get.</param>
        /// <param name="result">The specified setting value.</param>
        /// <returns><c>True</c> if the specified setting has been resolved; otherwise, <c>false</c>.</returns>
        bool TryGet(string name, out object result);

        /// <summary>
        /// Try gets the value associated with specified name.
        /// </summary>
        /// <param name="name">The setting name of the value to get.</param>
        /// <param name="result">The specified setting value.</param>
        /// <returns><c>True</c> if the specified setting has been resolved; otherwise, <c>false</c>.</returns>
        bool TryGet<T>(string name, out T result);

        /// <summary>
        /// Determines whether the specified setting name can be resolved.
        /// </summary>
        /// <param name="name">The setting name of the value to check.</param>
        /// <returns><c>True</c> if the specified setting has been contains; otherwise, <c>false</c>.</returns>
        bool IsContain(string name);

        /// <summary>
        /// Removes all settings.
        /// </summary>
        void Clear();

        /// <summary>
        /// Converts settings to dictionary.
        /// </summary>
        /// <returns>An instance of <see cref="IDictionary{TKey,TValue}"/></returns>
        IDictionary<string, object> ToDictionary();
    }
}